<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable('subject')) { return; }

        Schema::create('subject', function (Blueprint $table) {
            $table->id()->unique();
            $table->string('name')->comment('学科名称');
            $table->integer('grade_id')->comment('年级id');
            $table->creatorId();
            $table->createdAt();
            $table->updatedAt();

            $table->engine='InnoDB';
            $table->comment('学科表');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('subject');
    }
};
